<?php
class Default_Form_UserRegister extends Zend_Form{
  public function init() 
  {
	//set method
	$this->setMethod('post');
	
	// add fullname
	$this->addElement('text','name',array(
		'label'=>'Name',
		'required'=>true,
		'filters'=>array('StringTrim'),
		'validators'=>array('EmailAddress')
	));
	
	//add birthaday
	$this->addElement('text','birthday', array(
		'label'=>'Birthday',
		'required'=>True
	));
	
	// add sex
	$this->addElement('radio','sex',array(
		'label'=>'Sex',
		'multioptions'=>array(1=>'male', 0=>'Female')
	));
	
	//add phone
	$this->addElement('text','phone',array(
		'label'=>'Phone number',
		'filters'=>array('StringTrim'),
	));
	
	// Add an email element
	$this->addElement('text', 'email', array(
		'label'      => 'Your email address:',
		'required'   => true,
		'filters'    => array('StringTrim'),
		'validators' => array(
		   'EmailAddress',
		)
	));
	// Add a captcha
	$this->addElement('captcha', 'captcha', array(
		'label'      => 'Please enter the 5 letters displayed below:',
		'required'   => true,
		'captcha'    => array(
			'captcha' => 'Figlet',
			'wordLen' => 5,
			'timeout' => 300
		)
	));
	// Add the submit button
	$this->addElement('submit', 'submit', array(
		'ignore'   => true,
		'label'    => 'Register',
	));
 
	// And finally add some CSRF protection
	$this->addElement('hash', 'csrf', array(
		'ignore' => true,
	));
  }
}